/*
 Navicat Premium Data Transfer

 Source Server         : sqlserver
 Source Server Type    : SQL Server
 Source Server Version : 12002000
 Source Host           : 127.0.0.1:1433
 Source Catalog        : layui-security
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 12002000
 File Encoding         : 65001

 Date: 30/07/2020 17:42:48
*/


-- ----------------------------
-- Table structure for persistent_logins
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[persistent_logins]') AND type IN ('U'))
	DROP TABLE [dbo].[persistent_logins]
GO

CREATE TABLE [dbo].[persistent_logins] (
  [username] varchar(64) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [series] varchar(64) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [token] varchar(64) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [last_used] datetime  NOT NULL
)
GO

ALTER TABLE [dbo].[persistent_logins] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_menu]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_menu]
GO

CREATE TABLE [dbo].[sys_menu] (
  [mid] int  NOT NULL,
  [title] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [icon] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [href] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [spread] bit DEFAULT ((0)) NULL,
  [parent] int  NULL,
  [del_flg] bit DEFAULT ((1)) NULL,
  [type] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[sys_menu] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'1代表true，0代表false',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'del_flg'
GO


-- ----------------------------
-- Records of [sys_menu]
-- ----------------------------
INSERT INTO [dbo].[sys_menu]  VALUES (N'1', N'文章列表', N'icon-text', N'/security/news/newsList', N'0', N'0', N'1', N'contentManagement')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2', N'图片管理', N'&#xe634;', N'/security/img/images', N'0', N'0', N'1', N'contentManagement')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'3', N'其他页面', N'&#xe630;', N'', N'0', N'0', N'1', N'contentManagement')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'4', N'用户中心', N'&#xe612;', N'/security/user/userList', N'0', N'0', N'1', N'memberCenter')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'5', N'会员等级', N'icon-vip', N'/security/user/userGrade', N'0', N'0', N'1', N'memberCenter')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'6', N'系统基本参数', N'&#xe631;', N'/security/systemSetting/basicParameter', N'0', N'0', N'1', N'memberCenter')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'7', N'系统日志', N'icon-log', N'/security/systemSetting/logs', N'0', N'0', N'1', N'memberCenter')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'8', N'友情链接', N'&#xe64c;', N'/security/systemSetting/linkList', N'0', N'0', N'1', N'memberCenter')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'9', N'图标管理', N'&#xe857;', N'/security/systemSetting/icons', N'0', N'0', N'1', N'memberCenter')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'10', N'三级联动模块', N'icon-mokuai', N'/security/doc/addressDoc', N'0', N'0', N'1', N'seraphApi')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'11', N'bodyTab模块', N'icon-mokuai', N'/security/doc/bodyTabDoc', N'0', N'0', N'1', N'seraphApi')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'12', N'三级菜单', N'icon-mokuai', N'/security/doc/navDoc', N'0', N'0', N'1', N'seraphApi')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'13', N'系统基本参数', N'&#xe631;', N'/security/systemSetting/basicParameter', N'0', N'0', N'1', N'systemeSttings')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'14', N'系统日志', N'icon-log', N'/security/systemSetting/logs', N'0', N'0', N'1', N'systemeSttings')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'15', N'友情链接', N'&#xe64c;', N'/security/systemSetting/linkList', N'0', N'0', N'1', N'systemeSttings')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'16', N'图标管理', N'&#xe857;', N'/security/systemSetting/icons', N'0', N'0', N'1', N'systemeSttings')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'301', N'404页面', N'&#xe61c;', N'/security/404', N'0', N'3', N'1', N'contentManagement')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'302', N'登录', N'&#xe609;', N'/security/login/login', N'0', N'3', N'1', N'contentManagement')
GO


-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_role]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_role]
GO

CREATE TABLE [dbo].[sys_role] (
  [rid] int DEFAULT ((1)) NOT NULL,
  [rName] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [rDesc] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [del_flg] bit DEFAULT ((1)) NULL
)
GO

ALTER TABLE [dbo].[sys_role] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'1代表true，0代表false',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'del_flg'
GO


-- ----------------------------
-- Records of [sys_role]
-- ----------------------------
INSERT INTO [dbo].[sys_role]  VALUES (N'1', N'ROLE_emp', N'用户', N'1')
GO

INSERT INTO [dbo].[sys_role]  VALUES (N'2', N'ROLE_admin', N'管理员', N'1')
GO


-- ----------------------------
-- Table structure for sys_role_menu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_role_menu]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_role_menu]
GO

CREATE TABLE [dbo].[sys_role_menu] (
  [rid] int  NOT NULL,
  [mid] int  NOT NULL
)
GO

ALTER TABLE [dbo].[sys_role_menu] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Records of [sys_role_menu]
-- ----------------------------
INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'1')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'2')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'3')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'4')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'5')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'6')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'7')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'8')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'9')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'10')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'11')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'12')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'13')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'14')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'15')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'16')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'301')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'1', N'302')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'1')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'2')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'3')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'4')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'5')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'6')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'7')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'8')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'9')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'10')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'11')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'12')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'13')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'14')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'15')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'16')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'301')
GO

INSERT INTO [dbo].[sys_role_menu]  VALUES (N'2', N'302')
GO


-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_user]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_user]
GO

CREATE TABLE [dbo].[sys_user] (
  [uid] int  NOT NULL,
  [username] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [password] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [mobile] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [AccountNonExpired] bit DEFAULT ((1)) NULL,
  [AccountNonLocked] bit DEFAULT ((1)) NULL,
  [CredentialsNonExpired] bit DEFAULT ((1)) NULL,
  [Enabled] bit DEFAULT ((1)) NULL,
  [uName] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[sys_user] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'判断用户是否过期：1代表true，0代表false',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'AccountNonExpired'
GO

EXEC sp_addextendedproperty
'MS_Description', N'判断用户是否被锁定：1代表true，0代表false',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'AccountNonLocked'
GO

EXEC sp_addextendedproperty
'MS_Description', N'判断用户密码是否过期：1代表true，0代表false',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'CredentialsNonExpired'
GO

EXEC sp_addextendedproperty
'MS_Description', N'判断用户是否可用：1代表true，0代表false',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'Enabled'
GO


-- ----------------------------
-- Records of [sys_user]
-- ----------------------------
INSERT INTO [dbo].[sys_user]  VALUES (N'1', N'emp', N'$2a$10$0kciuxvJVHBmZsc6AOn67uz.dnbJPjayZ/K4g9lw5.1bhtIH.WVb2', N'13500005555', N'1', N'1', N'1', N'1', N'EMP')
GO

INSERT INTO [dbo].[sys_user]  VALUES (N'2', N'admin', N'$2a$10$0kciuxvJVHBmZsc6AOn67uz.dnbJPjayZ/K4g9lw5.1bhtIH.WVb2', N'13500005556', N'1', N'1', N'1', N'1', N'ADMIN')
GO


-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_user_role]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_user_role]
GO

CREATE TABLE [dbo].[sys_user_role] (
  [uid] int  NOT NULL,
  [rid] int  NOT NULL
)
GO

ALTER TABLE [dbo].[sys_user_role] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Records of [sys_user_role]
-- ----------------------------
INSERT INTO [dbo].[sys_user_role]  VALUES (N'1', N'1')
GO

INSERT INTO [dbo].[sys_user_role]  VALUES (N'1', N'2')
GO

INSERT INTO [dbo].[sys_user_role]  VALUES (N'2', N'1')
GO


-- ----------------------------
-- Primary Key structure for table persistent_logins
-- ----------------------------
ALTER TABLE [dbo].[persistent_logins] ADD CONSTRAINT [PK__persiste__617851A6FBEA8068] PRIMARY KEY CLUSTERED ([series])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_menu
-- ----------------------------
ALTER TABLE [dbo].[sys_menu] ADD CONSTRAINT [PK__sys_menu__DF5032EC117F9D94] PRIMARY KEY CLUSTERED ([mid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_role
-- ----------------------------
ALTER TABLE [dbo].[sys_role] ADD CONSTRAINT [PK__sys_role__C2B7EDE80DAF0CB0] PRIMARY KEY CLUSTERED ([rid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_role_menu
-- ----------------------------
ALTER TABLE [dbo].[sys_role_menu] ADD CONSTRAINT [PK__sys_role__1F42EEC61920BF5C] PRIMARY KEY CLUSTERED ([rid], [mid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_user
-- ----------------------------
ALTER TABLE [dbo].[sys_user] ADD CONSTRAINT [PK__sys_user__DD701264060DEAE8] PRIMARY KEY CLUSTERED ([uid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_user_role
-- ----------------------------
ALTER TABLE [dbo].[sys_user_role] ADD CONSTRAINT [PK__sys_user__415B6CBA9104CE5A] PRIMARY KEY CLUSTERED ([uid], [rid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

